<template>
  <div class="good">
    <div class="usercon">
      <div class="content">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/Home' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item>商品管理</el-breadcrumb-item>
          <el-breadcrumb-item>商品列表</el-breadcrumb-item>
        </el-breadcrumb>
        <div style="clear:both;"></div>
        <div class="Search">
          <div class="inputs">
            <input type="text" placeholder="请输入内容" />
            <div>
              <i class="el-icon-search"></i>
            </div>
          </div>
          <router-link to='/Goodadd'>
            <el-button type="success" plain>添加商品</el-button>
          </router-link>
        </div>
        <div style="margin-top:10px;">
          <el-table
            :data="tableData"
            border
            style="width: 100%;"
            height="450"
            ref="singleTable"
            stripe
          >
            <el-table-column type="index" width="49"></el-table-column>
            <el-table-column prop="cat_name" label="商品名称" width="770"></el-table-column>
            <el-table-column prop="path" label="商品价格（元）" width="100"></el-table-column>
            <el-table-column prop="id" label="商品重量" width="80"></el-table-column>
            <el-table-column prop="id" label="创建日期" width="120"></el-table-column>
            <el-table-column label="操作">
              <el-button type="primary" plain size="mini" is-circle class="btn">
                <i class="el-icon-edit"></i>
              </el-button>
              <el-button type="danger" plain size="mini" is-circle class="btn">
                <i class="el-icon-delete"></i>
              </el-button>
            </el-table-column>
          </el-table>
        </div>
        <div class="block">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync="currentPage2"
            :page-sizes="[100, 200, 300, 400]"
            :page-size="100"
            layout="total, sizes, prev, pager, next, jumper"
            :total="1000"
          ></el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>
     

<script>
export default {
  name: "good",
  data() {
    return {
      currentPage2: 5,
      tableData: []
    };
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    //获取用户 列表
    getgood() {
      this.$http("categories", {}, "get", {}).then(res => {
        this.tableData = res.data;
      });
    }
  },
  created() {
    this.getgood();
  }
};
</script>

<style scoped lang="scss">
.good {
  width: 100%;
  height: 100%;
  display: flex;
  overflow-y: scroll;
  overflow-x: hidden;
  .usercon {
    padding: 20px;
    margin: 60px 0 0 199px;
    flex: 1;
  }
  .content {
    height: 100%;
    background: #fff;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ebeef5;
    padding: 20px;
  }
  .Search {
    margin: 10px 0;
    display: flex;
    .inputs {
      width: 350px;
      display: flex;
      margin-right: 5px;
      > input {
        background-color: #fff;
        border-radius: 4px 0 0 4px;
        border: 1px solid #dcdfe6;
        box-sizing: border-box;
        color: #606266;
        display: inline-block;
        height: 40px;
        line-height: 40px;
        padding: 0 15px;
        width: 100%;
      }
      input::-webkit-input-placeholder {
        color: #ccc;
      }
      :focus {
        border: 1px solid #58a6e7;
      }
      > div {
        width: 57px;
        height: 40px;
        line-height: 40px;
        background-color: #f5f7fa;
        color: #909399;
        border-top: 1px solid #dcdfe6;
        border-right: 1px solid #dcdfe6;
        border-bottom: 1px solid #dcdfe6;
        border-radius: 0 4px 4px 0;
        padding: 0 20px;
        cursor: pointer;
        box-sizing: border-box;
      }
    }
  }
  .btn {
    border-radius: 50%;
    padding: 7px;
  }
}
</style>
